package model

import "gorm.io/gorm"

// 分类表
type Category struct {
	gorm.Model
	CategoryName     string `gorm:"not null;comment:分类名称"`
	ParentCategoryId int    `gorm:"not null;comment:父ID"`
}

// 评论表
type Comment struct {
	gorm.Model
	GoodsId  int    `gorm:"not null;comment:商品ID"`
	Comments string `gorm:"not null;comment:评论内容"`
}

// 购物车
type Shopping struct {
	gorm.Model
	GoodsId int `gorm:"not null;comment:商品ID"`
	Num     int `gorm:"not null;comment:数量"`
}

// 商品表
type Goods struct {
	gorm.Model
	Name       string `gorm:"not null;comment:商品名称"`
	CategoryId int    `gorm:"not null;default:0;comment:商品分类ID"`
	Category   Category
	Logo       string  `gorm:"not null;comment:商品logo"`
	Price      float64 `gorm:"not null;default:0;comment:商品价格"`
	Image      string  `gorm:"not null;comment:商品图片"`
	CommentId  int     `gorm:"not null;default:0;comment:商品评论ID"`
	Comment    Comment
	Stock      int `gorm:"not null;comment:商品库存"`
	IsHot      int `gorm:"not null;comment:商品浏览量"`
}
